package d1225;

import java.io.*;
import java.util.Date;

/*
     ObjectInputStream:对象字节输入流              反序列化
     把硬盘中的对象字节序列，读出，重构为对象


      public Object readObject()
      从 ObjectInputStream 读取对象。对象的类、类的签名和类及所有其超类型的非瞬态和非静态字段的值都将被读取
 */
public class p2 {
    public static void main(String[] args) {
        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream("ss.txt"))) {
            Object object = ois.readObject();

            if (object instanceof course.d1225.Student){
                course.d1225.Student d = (course.d1225.Student) object;
                System.out.println(d);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }
    }
}